package com.gwcm.service;

import com.gwcm.exception.BusinessException;
import com.gwcm.model.dto.login.DoLoginRequest;
import com.gwcm.model.dto.register.EmailRegisterRequest;
import com.gwcm.model.vo.CaptchaImageVo;
import com.gwcm.model.vo.TokenIdVo;
import org.springframework.transaction.annotation.Transactional;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * @author yanhuanzhan
 * @date 2023/3/27 - 19:29
 */
public interface ILoginService {
    /**
     * 获取oauth2登录链接
     * @return
     */
    String getOauthUrl();
    /**
     * 用户登录
     *
     * @param doLoginRequest
     * @param request
     * @param response
     * @return
     */
    String doLogin(DoLoginRequest doLoginRequest, HttpServletRequest request, HttpServletResponse response);

    /**
     * 用户注销
     */
    void doLogout();

    /**
     * 接收code处理oauth2登录
     * @param code
     * @param response
     */
    void oauthLogin(String code, HttpServletResponse response);

    /**
     * 向邮箱发送验证码
     * @param email
     */
    void mailSend(String email);

    /**
     * 邮箱注册
     * @param registerDto
     */
    @Transactional(rollbackFor = BusinessException.class)
    void emailRegister(EmailRegisterRequest registerDto);

    /**
     * 生成图片验证码
     * @return
     */
    CaptchaImageVo createCaptchImage();
}
